package org.example.controller;

import org.example.entity.ExamPaperEntity;
import org.example.entity.ExamPaperSaveRequest;
import org.example.entity.QuestionInfoEntity;
import org.example.service.ExamPaperSaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("exam_paper")
public class ExamPaperSaveController {

    @Autowired
    private ExamPaperSaveService examPaperSaveService;

    /**
     * 保存试卷及其题目
     *
     * @return 是否保存成功
     */
    @PostMapping("/save")
    public boolean saveExamPaperWithQuestions(@RequestBody ExamPaperSaveRequest request) {
        return examPaperSaveService.saveExamPaperWithQuestions(request.getExamPaper(), request.getQuestions());
    }
}

